#include <functional>
#include <iostream>
#include <numeric>
struct mult {
  int operator()(int x, int y) { return x + y; };
} mult_obj;
int main() {
  int a[] = {1, 2, 3};
  int b[] = {10, 20, 30};
  int init = 100;
  std::cout << std::inner_product(a, a + 3, b, init) << "\n";
  std::cout << std::inner_product(b, b + 3, a, init, std::minus<int>(),
                                  std::divides<int>())
            << "\n"; // 70
  std::cout << std::inner_product(b, b + 3, a, init, std::minus<int>(),
                                  mult_obj)
            << "\n"; // 34 = [11,22,33]==>100-11-22-33
}
